package com.xsb.butterknife;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.xsb.butterknife.annotation.BindView;
import com.xsb.butterknife.annotation.OnClick;
import com.xsb.butterknife.library.ButterKnife;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.button_1)
    public Button button1;
    @BindView(R.id.button_2)
    public Button button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.button_1)
    public void click(View view) {
        Toast.makeText(this, "点击了第一个按钮", Toast.LENGTH_SHORT).show();
        System.out.println("点击了第一个按钮");
    }

    @OnClick(R.id.button_2)
    public void click1() {
        Toast.makeText(this, "点击了第二个按钮", Toast.LENGTH_SHORT).show();
        System.out.println("点击了第二个按钮");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unBind(this);
    }
}